<template>
  <div class="main">
    <MyHeader title="我的购物车" color="red"></MyHeader>
    <MyGoods v-for="item in list" :key="item.id" :obj="item"></MyGoods>
    <MyFooter :list="list"></MyFooter>
  </div>
</template>

<script>
import axios from "axios";
import MyHeader from "./components/MyHeader.vue";
import MyGoods from "./components/MyGoods.vue";
import MyFooter from "./components/MyFooter.vue";
export default {
  data() {
    return {
      list: [],
    };
  },

  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  async created() {
    const { data: res } = await axios.get("https://www.escook.cn/api/cart");
    console.log(res);
    this.list = res.list;
  },
};
</script>

<style scoped>
.main {
  padding-top: 45px;
  padding-bottom: 50px;
}
</style>